﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using LibHuman;


namespace Human
{
	
	public class frm2_ngaycong : System.Windows.Forms.Form
    {
        #region Khai báo biến
        private AccessData mDB=new AccessData();
        Language lan = new Language();
        string sql = "", ma_nv = "";	
		string thang1="",nam1="",nam2="",s_mmyy="",s_bophan="";
        private System.Windows.Forms.Label label2;
		private System.Windows.Forms.ComboBox combobphan;
		private System.Windows.Forms.TextBox txtkoluong;
		private System.Windows.Forms.TextBox txtthaisan;
		private System.Windows.Forms.TextBox txtom;
        private System.Windows.Forms.TextBox txtphep;
        private System.Windows.Forms.ToolTip toolTip1;
		private System.ComponentModel.IContainer components;
        private DataSet ds = new DataSet();
        private DataSet dsABC = new DataSet();
        private System.Windows.Forms.ComboBox cbohoten;
		//int next =0,f=0,tam=0;
        decimal nc = 0;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.Label label8;
        private System.Windows.Forms.Label label10;
        private ToolStrip toolStrip3;
        private ToolStripButton toolStripButton4;
        private Panel ptxt;
        private Label label5;
        private TextBox txtManv;
        private Label label9;
        private Button butAdd;
        private ComboBox cboAbc;
        private Label lbl_abc;
        private Button cmdChon;
        private Label label;
        private DataGridView dataGridchamcong;
        private GroupBox groupBox1;
        private CheckBox checknghilau;
        private TextBox txtthoigiannghi;
        private Label label1;
        private Label label11;
        private Label label3;
        private TextBox txtconom;
        private Label label12;
        private Label label4;
        private TextBox txtsinhcon;
        private TextBox txtkhamthai;
        private Label label13;
        private TextBox txtnghibu;
        private Label label14;
        private Label label15;
        private TextBox txttainan;
        private TextBox txtnghikhac;
        private DataGridViewTextBoxColumn stt;
        private DataGridViewTextBoxColumn MA;
        private DataGridViewTextBoxColumn ten;
        private DataGridViewTextBoxColumn chucdanh;
        private DataGridViewTextBoxColumn ngaycong;
        private DataGridViewTextBoxColumn phepnam;
        private DataGridViewTextBoxColumn Colbu;
        private DataGridViewTextBoxColumn om;
        private DataGridViewTextBoxColumn Colcom;
        private DataGridViewTextBoxColumn Colkt;
        private DataGridViewTextBoxColumn thaisan;
        private DataGridViewTextBoxColumn Colsinhcon;
        private DataGridViewTextBoxColumn Coltn;
        private DataGridViewTextBoxColumn nghi_kl;
        private DataGridViewTextBoxColumn nghi_k;
        private DataGridViewTextBoxColumn so_ngaylav;
        private DataGridViewTextBoxColumn ntthang;
        private DataGridViewTextBoxColumn t7cn;
        private DataGridViewTextBoxColumn thuongabc;
        private DataGridViewTextBoxColumn Column2;
        private DataGridViewTextBoxColumn dilamlai;
        private DataGridViewTextBoxColumn thoigian;
        private DataGridViewTextBoxColumn phai;
        private DataGridViewTextBoxColumn Column3;
        private DataGridViewTextBoxColumn Column4;
        private DataGridViewTextBoxColumn Column5;
        private DataGridViewTextBoxColumn Column6;
        private DataGridViewTextBoxColumn Column7;
        private DataGridViewTextBoxColumn Column8;
        private DataGridViewTextBoxColumn Column9;
        private DataGridViewTextBoxColumn Column10;
        private DataGridViewTextBoxColumn Column11;
        private DataGridViewTextBoxColumn mucbdhv;
        private DataGridViewTextBoxColumn heso;
        private CheckBox ck_all;
        private Button btntonghop;
        private Button buttonsave;

        #endregion

        public frm2_ngaycong(string thang ,string nam,string s_bp)
		{
			InitializeComponent();
            lan.Read_Language_to_Xml(this.Name.ToString(), this);
            lan.Changelanguage_to_English(this.Name.ToString(), this);
			thang1=thang.Trim().PadLeft(2,'0');
			nam1=nam.Trim();
			nam2=nam1.Substring(2,2);
            s_mmyy = thang1 + nam2;
            s_bophan = s_bp;
            this.WindowState = FormWindowState.Maximized;
            cboAbc.Enabled=false;
            cmdChon.Enabled = false;
		}

        int ngay_lv = 0, songay = 0;
        DataSet ds_nghi;
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frm2_ngaycong));
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
            this.label2 = new System.Windows.Forms.Label();
            this.combobphan = new System.Windows.Forms.ComboBox();
            this.txtkoluong = new System.Windows.Forms.TextBox();
            this.txtthaisan = new System.Windows.Forms.TextBox();
            this.txtom = new System.Windows.Forms.TextBox();
            this.txtphep = new System.Windows.Forms.TextBox();
            this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
            this.butAdd = new System.Windows.Forms.Button();
            this.label6 = new System.Windows.Forms.Label();
            this.label7 = new System.Windows.Forms.Label();
            this.label8 = new System.Windows.Forms.Label();
            this.label10 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.buttonsave = new System.Windows.Forms.Button();
            this.cbohoten = new System.Windows.Forms.ComboBox();
            this.toolStrip3 = new System.Windows.Forms.ToolStrip();
            this.toolStripButton4 = new System.Windows.Forms.ToolStripButton();
            this.ptxt = new System.Windows.Forms.Panel();
            this.ck_all = new System.Windows.Forms.CheckBox();
            this.btntonghop = new System.Windows.Forms.Button();
            this.checknghilau = new System.Windows.Forms.CheckBox();
            this.label11 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.txtthoigiannghi = new System.Windows.Forms.TextBox();
            this.txtManv = new System.Windows.Forms.TextBox();
            this.label9 = new System.Windows.Forms.Label();
            this.label14 = new System.Windows.Forms.Label();
            this.label12 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.label15 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label13 = new System.Windows.Forms.Label();
            this.txtconom = new System.Windows.Forms.TextBox();
            this.txtnghibu = new System.Windows.Forms.TextBox();
            this.txttainan = new System.Windows.Forms.TextBox();
            this.txtsinhcon = new System.Windows.Forms.TextBox();
            this.txtkhamthai = new System.Windows.Forms.TextBox();
            this.txtnghikhac = new System.Windows.Forms.TextBox();
            this.cboAbc = new System.Windows.Forms.ComboBox();
            this.lbl_abc = new System.Windows.Forms.Label();
            this.cmdChon = new System.Windows.Forms.Button();
            this.label = new System.Windows.Forms.Label();
            this.dataGridchamcong = new System.Windows.Forms.DataGridView();
            this.stt = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.MA = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.ten = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.chucdanh = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.ngaycong = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.phepnam = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colbu = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.om = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colcom = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colkt = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.thaisan = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colsinhcon = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Coltn = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.nghi_kl = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.nghi_k = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.so_ngaylav = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.ntthang = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.t7cn = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.thuongabc = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.dilamlai = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.thoigian = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.phai = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.mucbdhv = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.heso = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.toolStrip3.SuspendLayout();
            this.ptxt.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridchamcong)).BeginInit();
            this.groupBox1.SuspendLayout();
            this.SuspendLayout();
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.BackColor = System.Drawing.Color.ForestGreen;
            this.label2.Font = new System.Drawing.Font("Tahoma", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label2.ForeColor = System.Drawing.Color.White;
            this.label2.Location = new System.Drawing.Point(8, 8);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(109, 24);
            this.label2.TabIndex = 0;
            this.label2.Text = "BỘ PHẬN:";
            this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // combobphan
            // 
            this.combobphan.BackColor = System.Drawing.SystemColors.HighlightText;
            this.combobphan.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.combobphan.Enabled = false;
            this.combobphan.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.combobphan.ForeColor = System.Drawing.Color.Navy;
            this.combobphan.Location = new System.Drawing.Point(116, 8);
            this.combobphan.Name = "combobphan";
            this.combobphan.Size = new System.Drawing.Size(214, 24);
            this.combobphan.TabIndex = 1;
            this.combobphan.Validating += new System.ComponentModel.CancelEventHandler(this.combobphan_Validating);
            this.combobphan.SelectedIndexChanged += new System.EventHandler(this.combobphan_SelectedIndexChanged);
            this.combobphan.KeyDown += new System.Windows.Forms.KeyEventHandler(this.combobphan_KeyDown);
            // 
            // txtkoluong
            // 
            this.txtkoluong.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.txtkoluong.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.txtkoluong.Location = new System.Drawing.Point(715, 23);
            this.txtkoluong.MaxLength = 5;
            this.txtkoluong.Name = "txtkoluong";
            this.txtkoluong.Size = new System.Drawing.Size(37, 21);
            this.txtkoluong.TabIndex = 9;
            this.txtkoluong.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            this.txtkoluong.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtphep_KeyPress);
            this.txtkoluong.Validated += new System.EventHandler(this.txtkoluong_Validated);
            this.txtkoluong.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtkoluong_KeyDown);
            // 
            // txtthaisan
            // 
            this.txtthaisan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.txtthaisan.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.txtthaisan.Location = new System.Drawing.Point(597, 23);
            this.txtthaisan.MaxLength = 5;
            this.txtthaisan.Name = "txtthaisan";
            this.txtthaisan.Size = new System.Drawing.Size(37, 21);
            this.txtthaisan.TabIndex = 6;
            this.txtthaisan.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            this.txtthaisan.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtphep_KeyPress);
            this.txtthaisan.Validated += new System.EventHandler(this.txtthaisan_Validated);
            this.txtthaisan.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtthaisan_KeyDown);
            // 
            // txtom
            // 
            this.txtom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.txtom.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.txtom.Location = new System.Drawing.Point(480, 23);
            this.txtom.MaxLength = 5;
            this.txtom.Name = "txtom";
            this.txtom.Size = new System.Drawing.Size(31, 21);
            this.txtom.TabIndex = 3;
            this.txtom.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            this.txtom.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtphep_KeyPress);
            this.txtom.Validated += new System.EventHandler(this.txtom_Validated);
            this.txtom.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtom_KeyDown);
            // 
            // txtphep
            // 
            this.txtphep.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.txtphep.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.txtphep.Location = new System.Drawing.Point(403, 23);
            this.txtphep.MaxLength = 5;
            this.txtphep.Name = "txtphep";
            this.txtphep.Size = new System.Drawing.Size(31, 21);
            this.txtphep.TabIndex = 1;
            this.txtphep.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            this.txtphep.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtphep_KeyPress);
            this.txtphep.Validated += new System.EventHandler(this.txtphep_Validated);
            this.txtphep.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtphep_KeyDown);
            // 
            // butAdd
            // 
            this.butAdd.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
            this.butAdd.BackColor = System.Drawing.SystemColors.Control;
            this.butAdd.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.butAdd.Image = global::Human.Properties.Resources.add;
            this.butAdd.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.butAdd.Location = new System.Drawing.Point(332, 51);
            this.butAdd.Name = "butAdd";
            this.butAdd.Size = new System.Drawing.Size(65, 28);
            this.butAdd.TabIndex = 13;
            this.butAdd.Text = "Thêm";
            this.butAdd.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.toolTip1.SetToolTip(this.butAdd, "Kế tiếp");
            this.butAdd.UseVisualStyleBackColor = true;
            this.butAdd.Click += new System.EventHandler(this.butAdd_Click);
            // 
            // label6
            // 
            this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.label6.AutoSize = true;
            this.label6.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label6.ForeColor = System.Drawing.Color.Navy;
            this.label6.Location = new System.Drawing.Point(403, 5);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(31, 13);
            this.label6.TabIndex = 25;
            this.label6.Text = "Phép";
            this.label6.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            this.toolTip1.SetToolTip(this.label6, "Số ngày nghỉ phép");
            // 
            // label7
            // 
            this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.label7.AutoSize = true;
            this.label7.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label7.ForeColor = System.Drawing.Color.Navy;
            this.label7.Location = new System.Drawing.Point(481, 7);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(23, 13);
            this.label7.TabIndex = 26;
            this.label7.Text = "Ốm";
            this.label7.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            this.toolTip1.SetToolTip(this.label7, "Số ngày nghỉ ốm");
            // 
            // label8
            // 
            this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.label8.AutoSize = true;
            this.label8.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label8.ForeColor = System.Drawing.Color.Navy;
            this.label8.Location = new System.Drawing.Point(594, 5);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(40, 13);
            this.label8.TabIndex = 27;
            this.label8.Text = "Nghỉ ts";
            this.label8.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            this.toolTip1.SetToolTip(this.label8, "Số ngày nghỉ thai sản");
            // 
            // label10
            // 
            this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.label10.AutoSize = true;
            this.label10.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label10.ForeColor = System.Drawing.Color.Navy;
            this.label10.Location = new System.Drawing.Point(714, 5);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(38, 13);
            this.label10.TabIndex = 28;
            this.label10.Text = "Nghỉ kl";
            this.label10.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            this.toolTip1.SetToolTip(this.label10, "Số ngày nghỉ không lương");
            // 
            // label1
            // 
            this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label1.ForeColor = System.Drawing.Color.Navy;
            this.label1.Location = new System.Drawing.Point(810, 5);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(80, 13);
            this.label1.TabIndex = 28;
            this.label1.Text = "Thu thêm BHYT";
            this.label1.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            this.toolTip1.SetToolTip(this.label1, "Thu thêm những người nghỉ hộ sản");
            // 
            // buttonsave
            // 
            this.buttonsave.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
            this.buttonsave.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.buttonsave.Image = global::Human.Properties.Resources.close_r;
            this.buttonsave.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.buttonsave.Location = new System.Drawing.Point(403, 51);
            this.buttonsave.Name = "buttonsave";
            this.buttonsave.Size = new System.Drawing.Size(65, 28);
            this.buttonsave.TabIndex = 14;
            this.buttonsave.Text = "&Thoát";
            this.buttonsave.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.toolTip1.SetToolTip(this.buttonsave, "Kết thúc");
            this.buttonsave.Click += new System.EventHandler(this.buttonsave_Click);
            // 
            // cbohoten
            // 
            this.cbohoten.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.cbohoten.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbohoten.ForeColor = System.Drawing.Color.Navy;
            this.cbohoten.Location = new System.Drawing.Point(60, 23);
            this.cbohoten.Name = "cbohoten";
            this.cbohoten.Size = new System.Drawing.Size(337, 21);
            this.cbohoten.TabIndex = 0;
            this.cbohoten.SelectedValueChanged += new System.EventHandler(this.cbohoten_SelectedValueChanged);
            this.cbohoten.KeyDown += new System.Windows.Forms.KeyEventHandler(this.cbohoten_KeyDown);
            // 
            // toolStrip3
            // 
            this.toolStrip3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.toolStrip3.AutoSize = false;
            this.toolStrip3.BackColor = System.Drawing.Color.ForestGreen;
            this.toolStrip3.Dock = System.Windows.Forms.DockStyle.None;
            this.toolStrip3.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.toolStripButton4});
            this.toolStrip3.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow;
            this.toolStrip3.Location = new System.Drawing.Point(0, 0);
            this.toolStrip3.Name = "toolStrip3";
            this.toolStrip3.Size = new System.Drawing.Size(925, 41);
            this.toolStrip3.TabIndex = 57;
            this.toolStrip3.Text = "toolStrip3";
            // 
            // toolStripButton4
            // 
            this.toolStripButton4.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
            this.toolStripButton4.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            this.toolStripButton4.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton4.Image")));
            this.toolStripButton4.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.toolStripButton4.Name = "toolStripButton4";
            this.toolStripButton4.Size = new System.Drawing.Size(23, 38);
            this.toolStripButton4.Text = "Hướng dẫn";
            // 
            // ptxt
            // 
            this.ptxt.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.ptxt.Controls.Add(this.ck_all);
            this.ptxt.Controls.Add(this.btntonghop);
            this.ptxt.Controls.Add(this.buttonsave);
            this.ptxt.Controls.Add(this.checknghilau);
            this.ptxt.Controls.Add(this.butAdd);
            this.ptxt.Controls.Add(this.label11);
            this.ptxt.Controls.Add(this.label5);
            this.ptxt.Controls.Add(this.txtthoigiannghi);
            this.ptxt.Controls.Add(this.txtManv);
            this.ptxt.Controls.Add(this.label9);
            this.ptxt.Controls.Add(this.label1);
            this.ptxt.Controls.Add(this.label14);
            this.ptxt.Controls.Add(this.label12);
            this.ptxt.Controls.Add(this.label4);
            this.ptxt.Controls.Add(this.label15);
            this.ptxt.Controls.Add(this.label10);
            this.ptxt.Controls.Add(this.label8);
            this.ptxt.Controls.Add(this.label3);
            this.ptxt.Controls.Add(this.label13);
            this.ptxt.Controls.Add(this.label7);
            this.ptxt.Controls.Add(this.label6);
            this.ptxt.Controls.Add(this.cbohoten);
            this.ptxt.Controls.Add(this.txtphep);
            this.ptxt.Controls.Add(this.txtconom);
            this.ptxt.Controls.Add(this.txtnghibu);
            this.ptxt.Controls.Add(this.txtom);
            this.ptxt.Controls.Add(this.txtthaisan);
            this.ptxt.Controls.Add(this.txttainan);
            this.ptxt.Controls.Add(this.txtsinhcon);
            this.ptxt.Controls.Add(this.txtkhamthai);
            this.ptxt.Controls.Add(this.txtnghikhac);
            this.ptxt.Controls.Add(this.txtkoluong);
            this.ptxt.Location = new System.Drawing.Point(0, 491);
            this.ptxt.Margin = new System.Windows.Forms.Padding(0);
            this.ptxt.Name = "ptxt";
            this.ptxt.Size = new System.Drawing.Size(925, 82);
            this.ptxt.TabIndex = 3;
            // 
            // ck_all
            // 
            this.ck_all.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
            this.ck_all.AutoSize = true;
            this.ck_all.Location = new System.Drawing.Point(563, 54);
            this.ck_all.Name = "ck_all";
            this.ck_all.Size = new System.Drawing.Size(115, 17);
            this.ck_all.TabIndex = 62;
            this.ck_all.Text = "Toàn bộ nhân viên";
            this.ck_all.UseVisualStyleBackColor = true;
            // 
            // btntonghop
            // 
            this.btntonghop.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
            this.btntonghop.Enabled = false;
            this.btntonghop.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.btntonghop.Image = global::Human.Properties.Resources.ok;
            this.btntonghop.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.btntonghop.Location = new System.Drawing.Point(474, 51);
            this.btntonghop.Name = "btntonghop";
            this.btntonghop.Size = new System.Drawing.Size(80, 28);
            this.btntonghop.TabIndex = 35;
            this.btntonghop.Text = "Tổng hợp";
            this.btntonghop.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.btntonghop.UseVisualStyleBackColor = true;
            this.btntonghop.Click += new System.EventHandler(this.btntonghop_Click);
            // 
            // checknghilau
            // 
            this.checknghilau.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.checknghilau.AutoSize = true;
            this.checknghilau.Location = new System.Drawing.Point(813, 30);
            this.checknghilau.Name = "checknghilau";
            this.checknghilau.Size = new System.Drawing.Size(15, 14);
            this.checknghilau.TabIndex = 11;
            this.checknghilau.UseVisualStyleBackColor = true;
            this.checknghilau.Validated += new System.EventHandler(this.checknghilau_Validated);
            this.checknghilau.CheckedChanged += new System.EventHandler(this.checknghilau_CheckedChanged);
            this.checknghilau.KeyDown += new System.Windows.Forms.KeyEventHandler(this.checknghilau_KeyDown);
            // 
            // label11
            // 
            this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.label11.AutoSize = true;
            this.label11.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.label11.Location = new System.Drawing.Point(871, 28);
            this.label11.Name = "label11";
            this.label11.Size = new System.Drawing.Size(37, 13);
            this.label11.TabIndex = 34;
            this.label11.Text = "Tháng";
            // 
            // label5
            // 
            this.label5.AutoSize = true;
            this.label5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.label5.Location = new System.Drawing.Point(11, 5);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(37, 13);
            this.label5.TabIndex = 30;
            this.label5.Text = "Mã NV";
            // 
            // txtthoigiannghi
            // 
            this.txtthoigiannghi.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.txtthoigiannghi.BackColor = System.Drawing.Color.White;
            this.txtthoigiannghi.Enabled = false;
            this.txtthoigiannghi.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.txtthoigiannghi.Location = new System.Drawing.Point(834, 23);
            this.txtthoigiannghi.Name = "txtthoigiannghi";
            this.txtthoigiannghi.Size = new System.Drawing.Size(31, 21);
            this.txtthoigiannghi.TabIndex = 12;
            this.txtthoigiannghi.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtphep_KeyPress);
            this.txtthoigiannghi.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtPhai_KeyDown);
            // 
            // txtManv
            // 
            this.txtManv.BackColor = System.Drawing.Color.White;
            this.txtManv.Enabled = false;
            this.txtManv.ForeColor = System.Drawing.Color.Navy;
            this.txtManv.Location = new System.Drawing.Point(4, 23);
            this.txtManv.Name = "txtManv";
            this.txtManv.ReadOnly = true;
            this.txtManv.Size = new System.Drawing.Size(50, 21);
            this.txtManv.TabIndex = 0;
            this.txtManv.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtManv_KeyDown);
            // 
            // label9
            // 
            this.label9.AutoSize = true;
            this.label9.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.label9.Location = new System.Drawing.Point(82, 5);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(39, 13);
            this.label9.TabIndex = 32;
            this.label9.Text = "Họ tên";
            // 
            // label14
            // 
            this.label14.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.label14.AutoSize = true;
            this.label14.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label14.ForeColor = System.Drawing.Color.Navy;
            this.label14.Location = new System.Drawing.Point(676, 5);
            this.label14.Name = "label14";
            this.label14.Size = new System.Drawing.Size(39, 13);
            this.label14.TabIndex = 28;
            this.label14.Text = "T. Nạn";
            this.label14.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            // 
            // label12
            // 
            this.label12.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.label12.AutoSize = true;
            this.label12.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label12.ForeColor = System.Drawing.Color.Navy;
            this.label12.Location = new System.Drawing.Point(638, 5);
            this.label12.Name = "label12";
            this.label12.Size = new System.Drawing.Size(34, 13);
            this.label12.TabIndex = 28;
            this.label12.Text = "S.con";
            this.label12.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            // 
            // label4
            // 
            this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.label4.AutoSize = true;
            this.label4.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label4.ForeColor = System.Drawing.Color.Navy;
            this.label4.Location = new System.Drawing.Point(554, 5);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(37, 13);
            this.label4.TabIndex = 28;
            this.label4.Text = "K.Thai";
            this.label4.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            // 
            // label15
            // 
            this.label15.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.label15.AutoSize = true;
            this.label15.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label15.ForeColor = System.Drawing.Color.Navy;
            this.label15.Location = new System.Drawing.Point(759, 5);
            this.label15.Name = "label15";
            this.label15.Size = new System.Drawing.Size(44, 13);
            this.label15.TabIndex = 28;
            this.label15.Text = "N. Khác";
            this.label15.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            // 
            // label3
            // 
            this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.label3.AutoSize = true;
            this.label3.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label3.ForeColor = System.Drawing.Color.Navy;
            this.label3.Location = new System.Drawing.Point(516, 7);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(35, 13);
            this.label3.TabIndex = 26;
            this.label3.Text = "C. ốm";
            this.label3.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            // 
            // label13
            // 
            this.label13.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.label13.AutoSize = true;
            this.label13.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label13.ForeColor = System.Drawing.Color.Navy;
            this.label13.Location = new System.Drawing.Point(443, 7);
            this.label13.Name = "label13";
            this.label13.Size = new System.Drawing.Size(33, 13);
            this.label13.TabIndex = 26;
            this.label13.Text = "N. Bù";
            this.label13.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            // 
            // txtconom
            // 
            this.txtconom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.txtconom.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.txtconom.Location = new System.Drawing.Point(518, 23);
            this.txtconom.MaxLength = 5;
            this.txtconom.Name = "txtconom";
            this.txtconom.Size = new System.Drawing.Size(31, 21);
            this.txtconom.TabIndex = 4;
            this.txtconom.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            this.txtconom.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtphep_KeyPress);
            this.txtconom.Validated += new System.EventHandler(this.txtconom_Validated);
            this.txtconom.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtom_KeyDown);
            // 
            // txtnghibu
            // 
            this.txtnghibu.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.txtnghibu.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.txtnghibu.Location = new System.Drawing.Point(441, 23);
            this.txtnghibu.MaxLength = 5;
            this.txtnghibu.Name = "txtnghibu";
            this.txtnghibu.Size = new System.Drawing.Size(31, 21);
            this.txtnghibu.TabIndex = 2;
            this.txtnghibu.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            this.txtnghibu.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtphep_KeyPress);
            this.txtnghibu.Validated += new System.EventHandler(this.txtnghibu_Validated);
            this.txtnghibu.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtom_KeyDown);
            // 
            // txttainan
            // 
            this.txttainan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.txttainan.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.txttainan.Location = new System.Drawing.Point(677, 23);
            this.txttainan.MaxLength = 5;
            this.txttainan.Name = "txttainan";
            this.txttainan.Size = new System.Drawing.Size(33, 21);
            this.txttainan.TabIndex = 8;
            this.txttainan.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            this.txttainan.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtphep_KeyPress);
            this.txttainan.Validated += new System.EventHandler(this.txttainan_Validated);
            this.txttainan.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtkoluong_KeyDown);
            // 
            // txtsinhcon
            // 
            this.txtsinhcon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.txtsinhcon.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.txtsinhcon.Location = new System.Drawing.Point(639, 23);
            this.txtsinhcon.MaxLength = 5;
            this.txtsinhcon.Name = "txtsinhcon";
            this.txtsinhcon.Size = new System.Drawing.Size(33, 21);
            this.txtsinhcon.TabIndex = 7;
            this.txtsinhcon.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            this.txtsinhcon.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtphep_KeyPress);
            this.txtsinhcon.Validated += new System.EventHandler(this.txtsinhcon_Validated);
            this.txtsinhcon.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtkoluong_KeyDown);
            // 
            // txtkhamthai
            // 
            this.txtkhamthai.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.txtkhamthai.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.txtkhamthai.Location = new System.Drawing.Point(555, 23);
            this.txtkhamthai.MaxLength = 5;
            this.txtkhamthai.Name = "txtkhamthai";
            this.txtkhamthai.Size = new System.Drawing.Size(36, 21);
            this.txtkhamthai.TabIndex = 5;
            this.txtkhamthai.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            this.txtkhamthai.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtphep_KeyPress);
            this.txtkhamthai.Validated += new System.EventHandler(this.txtkhamthai_Validated);
            this.txtkhamthai.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtkoluong_KeyDown);
            // 
            // txtnghikhac
            // 
            this.txtnghikhac.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.txtnghikhac.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(160)))));
            this.txtnghikhac.Location = new System.Drawing.Point(760, 23);
            this.txtnghikhac.MaxLength = 10;
            this.txtnghikhac.Name = "txtnghikhac";
            this.txtnghikhac.Size = new System.Drawing.Size(43, 21);
            this.txtnghikhac.TabIndex = 10;
            this.txtnghikhac.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            this.txtnghikhac.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtphep_KeyPress);
            this.txtnghikhac.Validated += new System.EventHandler(this.txtnghikhac_Validated);
            this.txtnghikhac.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtkoluong_KeyDown);
            // 
            // cboAbc
            // 
            this.cboAbc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.cboAbc.BackColor = System.Drawing.SystemColors.HighlightText;
            this.cboAbc.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cboAbc.Font = new System.Drawing.Font("Tahoma", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.cboAbc.ForeColor = System.Drawing.Color.Navy;
            this.cboAbc.Location = new System.Drawing.Point(1004, 8);
            this.cboAbc.Name = "cboAbc";
            this.cboAbc.Size = new System.Drawing.Size(74, 26);
            this.cboAbc.TabIndex = 59;
            // 
            // lbl_abc
            // 
            this.lbl_abc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.lbl_abc.AutoSize = true;
            this.lbl_abc.BackColor = System.Drawing.Color.ForestGreen;
            this.lbl_abc.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lbl_abc.ForeColor = System.Drawing.Color.White;
            this.lbl_abc.Location = new System.Drawing.Point(616, 8);
            this.lbl_abc.Name = "lbl_abc";
            this.lbl_abc.Size = new System.Drawing.Size(136, 19);
            this.lbl_abc.TabIndex = 58;
            this.lbl_abc.Text = "Tất cả đều loại:";
            this.lbl_abc.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lbl_abc.Visible = false;
            // 
            // cmdChon
            // 
            this.cmdChon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.cmdChon.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.cmdChon.Location = new System.Drawing.Point(1081, 9);
            this.cmdChon.Name = "cmdChon";
            this.cmdChon.Size = new System.Drawing.Size(29, 25);
            this.cmdChon.TabIndex = 60;
            this.cmdChon.Text = "...";
            this.cmdChon.UseVisualStyleBackColor = true;
            this.cmdChon.Click += new System.EventHandler(this.cmdChon_Click);
            // 
            // label
            // 
            this.label.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(236)))), ((int)(((byte)(233)))), ((int)(((byte)(216)))));
            this.label.Dock = System.Windows.Forms.DockStyle.Fill;
            this.label.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label.Location = new System.Drawing.Point(0, 0);
            this.label.Name = "label";
            this.label.Size = new System.Drawing.Size(925, 573);
            this.label.TabIndex = 35;
            this.label.Click += new System.EventHandler(this.label_Click);
            // 
            // dataGridchamcong
            // 
            this.dataGridchamcong.AllowUserToAddRows = false;
            this.dataGridchamcong.AllowUserToDeleteRows = false;
            this.dataGridchamcong.AllowUserToOrderColumns = true;
            this.dataGridchamcong.AllowUserToResizeRows = false;
            this.dataGridchamcong.BackgroundColor = System.Drawing.Color.White;
            dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control;
            dataGridViewCellStyle10.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText;
            dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight;
            dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
            dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
            this.dataGridchamcong.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10;
            this.dataGridchamcong.ColumnHeadersHeight = 25;
            this.dataGridchamcong.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.stt,
            this.MA,
            this.ten,
            this.chucdanh,
            this.ngaycong,
            this.phepnam,
            this.Colbu,
            this.om,
            this.Colcom,
            this.Colkt,
            this.thaisan,
            this.Colsinhcon,
            this.Coltn,
            this.nghi_kl,
            this.nghi_k,
            this.so_ngaylav,
            this.ntthang,
            this.t7cn,
            this.thuongabc,
            this.Column2,
            this.dilamlai,
            this.thoigian,
            this.phai,
            this.Column3,
            this.Column4,
            this.Column5,
            this.Column6,
            this.Column7,
            this.Column8,
            this.Column9,
            this.Column10,
            this.Column11,
            this.mucbdhv,
            this.heso});
            this.dataGridchamcong.Dock = System.Windows.Forms.DockStyle.Fill;
            this.dataGridchamcong.Location = new System.Drawing.Point(3, 17);
            this.dataGridchamcong.Name = "dataGridchamcong";
            this.dataGridchamcong.ReadOnly = true;
            this.dataGridchamcong.RowHeadersWidth = 15;
            this.dataGridchamcong.Size = new System.Drawing.Size(919, 400);
            this.dataGridchamcong.TabIndex = 3;
            this.dataGridchamcong.CellMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridchamcong_CellMouseClick);
            this.dataGridchamcong.CurrentCellChanged += new System.EventHandler(this.dataGridchamcong_CurrentCellChanged);
            // 
            // stt
            // 
            this.stt.DataPropertyName = "stt";
            dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.stt.DefaultCellStyle = dataGridViewCellStyle11;
            this.stt.HeaderText = "STT";
            this.stt.Name = "stt";
            this.stt.ReadOnly = true;
            this.stt.Width = 25;
            // 
            // MA
            // 
            this.MA.DataPropertyName = "manv";
            dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            this.MA.DefaultCellStyle = dataGridViewCellStyle12;
            this.MA.HeaderText = "Mã NV";
            this.MA.Name = "MA";
            this.MA.ReadOnly = true;
            this.MA.Width = 60;
            // 
            // ten
            // 
            this.ten.DataPropertyName = "hoten";
            this.ten.HeaderText = "Họ và tên";
            this.ten.Name = "ten";
            this.ten.ReadOnly = true;
            this.ten.Width = 180;
            // 
            // chucdanh
            // 
            this.chucdanh.DataPropertyName = "chucdanh";
            this.chucdanh.HeaderText = "Chức danh";
            this.chucdanh.Name = "chucdanh";
            this.chucdanh.ReadOnly = true;
            this.chucdanh.Width = 120;
            // 
            // ngaycong
            // 
            this.ngaycong.DataPropertyName = "ngay_tt";
            dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            this.ngaycong.DefaultCellStyle = dataGridViewCellStyle13;
            this.ngaycong.HeaderText = "Ngày công";
            this.ngaycong.Name = "ngaycong";
            this.ngaycong.ReadOnly = true;
            this.ngaycong.Width = 80;
            // 
            // phepnam
            // 
            this.phepnam.DataPropertyName = "nghi_pn";
            dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            dataGridViewCellStyle14.Format = "N0";
            dataGridViewCellStyle14.NullValue = null;
            this.phepnam.DefaultCellStyle = dataGridViewCellStyle14;
            this.phepnam.HeaderText = "Nghỉ phép";
            this.phepnam.Name = "phepnam";
            this.phepnam.ReadOnly = true;
            this.phepnam.ToolTipText = "Số ngày nghỉ phép";
            this.phepnam.Width = 80;
            // 
            // Colbu
            // 
            this.Colbu.DataPropertyName = "nghi_bu";
            this.Colbu.HeaderText = "Nghỉ bù";
            this.Colbu.Name = "Colbu";
            this.Colbu.ReadOnly = true;
            // 
            // om
            // 
            this.om.DataPropertyName = "nghi_om";
            dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            dataGridViewCellStyle15.Format = "N0";
            dataGridViewCellStyle15.NullValue = null;
            this.om.DefaultCellStyle = dataGridViewCellStyle15;
            this.om.HeaderText = "Ốm";
            this.om.Name = "om";
            this.om.ReadOnly = true;
            this.om.Width = 50;
            // 
            // Colcom
            // 
            this.Colcom.DataPropertyName = "nghi_co";
            this.Colcom.HeaderText = "T.Con ốm";
            this.Colcom.Name = "Colcom";
            this.Colcom.ReadOnly = true;
            // 
            // Colkt
            // 
            this.Colkt.DataPropertyName = "nghi_kt";
            this.Colkt.HeaderText = "Khám thai";
            this.Colkt.Name = "Colkt";
            this.Colkt.ReadOnly = true;
            // 
            // thaisan
            // 
            this.thaisan.DataPropertyName = "nghi_ts";
            dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            dataGridViewCellStyle16.Format = "N0";
            this.thaisan.DefaultCellStyle = dataGridViewCellStyle16;
            this.thaisan.HeaderText = "Thai sản";
            this.thaisan.Name = "thaisan";
            this.thaisan.ReadOnly = true;
            this.thaisan.Width = 80;
            // 
            // Colsinhcon
            // 
            this.Colsinhcon.DataPropertyName = "nghi_sc";
            this.Colsinhcon.HeaderText = "Sinh con";
            this.Colsinhcon.Name = "Colsinhcon";
            this.Colsinhcon.ReadOnly = true;
            // 
            // Coltn
            // 
            this.Coltn.DataPropertyName = "nghi_tn";
            this.Coltn.HeaderText = "Tai nạn";
            this.Coltn.Name = "Coltn";
            this.Coltn.ReadOnly = true;
            // 
            // nghi_kl
            // 
            this.nghi_kl.DataPropertyName = "nghi_kl";
            dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            dataGridViewCellStyle17.Format = "N0";
            this.nghi_kl.DefaultCellStyle = dataGridViewCellStyle17;
            this.nghi_kl.HeaderText = "Không lương";
            this.nghi_kl.Name = "nghi_kl";
            this.nghi_kl.ReadOnly = true;
            // 
            // nghi_k
            // 
            this.nghi_k.DataPropertyName = "nghi_khac";
            this.nghi_k.HeaderText = "Nghỉ khác";
            this.nghi_k.Name = "nghi_k";
            this.nghi_k.ReadOnly = true;
            // 
            // so_ngaylav
            // 
            this.so_ngaylav.DataPropertyName = "ngay_lv";
            dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
            dataGridViewCellStyle18.Format = "#,#0";
            this.so_ngaylav.DefaultCellStyle = dataGridViewCellStyle18;
            this.so_ngaylav.HeaderText = "Số ngày làm việc";
            this.so_ngaylav.Name = "so_ngaylav";
            this.so_ngaylav.ReadOnly = true;
            this.so_ngaylav.Width = 105;
            // 
            // ntthang
            // 
            this.ntthang.DataPropertyName = "ntthang";
            this.ntthang.HeaderText = "Ngày trong tháng";
            this.ntthang.Name = "ntthang";
            this.ntthang.ReadOnly = true;
            // 
            // t7cn
            // 
            this.t7cn.DataPropertyName = "t7cn";
            this.t7cn.HeaderText = "Số ngày cuối tuần";
            this.t7cn.Name = "t7cn";
            this.t7cn.ReadOnly = true;
            // 
            // thuongabc
            // 
            this.thuongabc.DataPropertyName = "thuongabc";
            this.thuongabc.HeaderText = "Thưởng ABC";
            this.thuongabc.Name = "thuongabc";
            this.thuongabc.ReadOnly = true;
            this.thuongabc.Visible = false;
            // 
            // Column2
            // 
            this.Column2.DataPropertyName = "madv";
            this.Column2.HeaderText = "madv";
            this.Column2.Name = "Column2";
            this.Column2.ReadOnly = true;
            this.Column2.Visible = false;
            // 
            // dilamlai
            // 
            this.dilamlai.DataPropertyName = "dilamlai";
            this.dilamlai.HeaderText = "dilamlai";
            this.dilamlai.Name = "dilamlai";
            this.dilamlai.ReadOnly = true;
            this.dilamlai.Visible = false;
            // 
            // thoigian
            // 
            this.thoigian.DataPropertyName = "thoigian";
            this.thoigian.HeaderText = "thoigian";
            this.thoigian.Name = "thoigian";
            this.thoigian.ReadOnly = true;
            this.thoigian.Visible = false;
            // 
            // phai
            // 
            this.phai.DataPropertyName = "phai";
            this.phai.HeaderText = "phai";
            this.phai.Name = "phai";
            this.phai.ReadOnly = true;
            this.phai.Visible = false;
            // 
            // Column3
            // 
            this.Column3.DataPropertyName = "caba";
            this.Column3.HeaderText = "caba";
            this.Column3.Name = "Column3";
            this.Column3.ReadOnly = true;
            this.Column3.Visible = false;
            // 
            // Column4
            // 
            this.Column4.DataPropertyName = "gio_cn";
            this.Column4.HeaderText = "gio_cn";
            this.Column4.Name = "Column4";
            this.Column4.ReadOnly = true;
            this.Column4.Visible = false;
            // 
            // Column5
            // 
            this.Column5.DataPropertyName = "letet";
            this.Column5.HeaderText = "letet";
            this.Column5.Name = "Column5";
            this.Column5.ReadOnly = true;
            this.Column5.Visible = false;
            // 
            // Column6
            // 
            this.Column6.DataPropertyName = "hcaba";
            this.Column6.HeaderText = "hcaba";
            this.Column6.Name = "Column6";
            this.Column6.ReadOnly = true;
            this.Column6.Visible = false;
            // 
            // Column7
            // 
            this.Column7.DataPropertyName = "hgio_cn";
            this.Column7.HeaderText = "hgio_cn";
            this.Column7.Name = "Column7";
            this.Column7.ReadOnly = true;
            this.Column7.Visible = false;
            // 
            // Column8
            // 
            this.Column8.DataPropertyName = "hletet";
            this.Column8.HeaderText = "hletet";
            this.Column8.Name = "Column8";
            this.Column8.ReadOnly = true;
            this.Column8.Visible = false;
            // 
            // Column9
            // 
            this.Column9.DataPropertyName = "chinh1";
            this.Column9.HeaderText = "chinh1";
            this.Column9.Name = "Column9";
            this.Column9.ReadOnly = true;
            this.Column9.Visible = false;
            // 
            // Column10
            // 
            this.Column10.DataPropertyName = "phu1";
            this.Column10.HeaderText = "phu1";
            this.Column10.Name = "Column10";
            this.Column10.ReadOnly = true;
            this.Column10.Visible = false;
            // 
            // Column11
            // 
            this.Column11.DataPropertyName = "phu2";
            this.Column11.HeaderText = "phu2";
            this.Column11.Name = "Column11";
            this.Column11.ReadOnly = true;
            this.Column11.Visible = false;
            // 
            // mucbdhv
            // 
            this.mucbdhv.DataPropertyName = "mucbdhv";
            this.mucbdhv.HeaderText = "mucbdhv";
            this.mucbdhv.Name = "mucbdhv";
            this.mucbdhv.ReadOnly = true;
            this.mucbdhv.Visible = false;
            // 
            // heso
            // 
            this.heso.DataPropertyName = "heso";
            this.heso.HeaderText = "heso";
            this.heso.Name = "heso";
            this.heso.ReadOnly = true;
            this.heso.Visible = false;
            // 
            // groupBox1
            // 
            this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.groupBox1.Controls.Add(this.dataGridchamcong);
            this.groupBox1.Location = new System.Drawing.Point(0, 44);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(925, 420);
            this.groupBox1.TabIndex = 61;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Bảng chấm công";
            // 
            // frm2_ngaycong
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(925, 573);
            this.ControlBox = false;
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.cmdChon);
            this.Controls.Add(this.cboAbc);
            this.Controls.Add(this.lbl_abc);
            this.Controls.Add(this.ptxt);
            this.Controls.Add(this.combobphan);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.toolStrip3);
            this.Controls.Add(this.label);
            this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.ForeColor = System.Drawing.Color.Navy;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "frm2_ngaycong";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Bảng chấm công ";
            this.Load += new System.EventHandler(this.frm2_ngaycong_Load);
            this.toolStrip3.ResumeLayout(false);
            this.toolStrip3.PerformLayout();
            this.ptxt.ResumeLayout(false);
            this.ptxt.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridchamcong)).EndInit();
            this.groupBox1.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();

		}
		#endregion

		private void buttonclose_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}   

		public void buttonsave_Click(object sender, System.EventArgs e)
		{
            this.Close();
		}

        public void update_dll()
        {
            //if (checknghilau.Checked)
            //    //mDB.update_dll(txtManv.Text, s_mmyy, true, txtthoigiannghi.Text.Trim());
            //else
            //    mDB.Execute_data("delete from "+mDB.user_payroll+".dll where manv='"+txtManv.Text+"' and mmyy='"+s_mmyy+"'");
        }

        public void save(DataSet dss)
        {
            //mDB.upd_rec(thang1, nam1, dss);
            update_dll();
        }
		
		private void lamsach()
		{
			txtManv.Text="";txtphep.Text="";
			txtom.Text="";txtkoluong.Text="";txtthaisan.Text="";
		}
        public void NavigationRecord(string vitri)
        {
            switch (vitri)
            {
                case "DAU":
                    this.BindingContext[ds.Tables[0]].Position = 0;
                    break;
                case "TRUOC":
                    this.BindingContext[ds.Tables[0]].Position -= 1;
                    break;
                case "SAU":
                    this.BindingContext[ds.Tables[0]].Position += 1;
                    break;
                case "CUOI":
                    this.BindingContext[ds.Tables[0]].Position = ds.Tables[0].Rows.Count - 1;
                    break;
            }

        }
        public int f = 0;
        private void frm2_ngaycong_Load(object sender, EventArgs e)
        {
            this.Text = lan.Change_language_MessageText("Bảng chấm công tháng ") + thang1 + "/" + nam1;
            this.WindowState = FormWindowState.Maximized;
            f = 1;
            //
            sql = "select * from " + mDB.user + ".heso where mm='" + thang1 + "' and yyyy='" + nam1 + "'";
            foreach (DataRow r1 in mDB.get_data(sql).Tables[0].Rows)
                nc = decimal.Parse(r1["lamviec"].ToString());
            //dsABC.Tables.Add();
            //dsABC.Tables[0].Columns.Add("Ma", typeof(string));
            //DataRow r = dsABC.Tables[0].NewRow();
            //r["ma"] = "A";
            //dsABC.Tables[0].Rows.Add(r);
            //r = dsABC.Tables[0].NewRow();
            //r["ma"] = "B";
            //dsABC.Tables[0].Rows.Add(r);
            //r = dsABC.Tables[0].NewRow();
            //r["ma"] = "C";
            //dsABC.Tables[0].Rows.Add(r);
            ////
            //cboAbc.DisplayMember = "ma";
            //cboAbc.ValueMember = "ma";
            //cboAbc.DataSource = dsABC.Tables[0].Copy();
            //cboAbc.SelectedIndex = -1;
            //
            sql = "select * from " + mDB.user + ".bophan order by madv ";
            combobphan.DisplayMember = "tenbp";
            combobphan.ValueMember = "madv";
            combobphan.DataSource = mDB.get_data(sql).Tables[0];
            combobphan.SelectedValue = s_bophan;
            newDataset();
            load_datagrid();
            tonghop();
            btntonghop.Enabled = mDB.get_tonghopcc(thang1, nam1);
        }

		private void cbohoten_SelectedValueChanged(object sender, System.EventArgs e)
		{
            try
            {
                if (this.ActiveControl == cbohoten)
                    txtManv.Text = cbohoten.SelectedValue.ToString();
            }
            catch
            { }
		}
		
		private void txtphep_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{Tab}");
		}

		private void txtom_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{Tab}");					
		}

		private void txtthaisan_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{Tab}");
		}
		private void combobphan_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{Tab}{F4}");				
		}

		private void txtcoluong_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{Tab}");
		}

		private void txtkoluong_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{Tab}{F4}");
		}

		private void txttpcts_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{Tab}");
		}
		
		private void txthoten_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{	
			if(e.KeyCode==Keys.Enter)
			{
				try
				{
                    txtManv.Text = "";
					SendKeys.Send("{Tab}{F4}");		
				}
				catch{}
			}
		}

		private void cbohoten_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			try
			{
				if(e.KeyCode==Keys.Enter)
				{
					
					SendKeys.Send("{Tab}");		
				}
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.ToString());
			}
		}

		private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
			{
				SendKeys.Send("{Tab}{F4}");	
			}
		}	

		private void txtthuong_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{Tab}");
		}

		private void txtchunhat_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{Tab}");
		}

		private void txtle_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{Tab}");
		}

		private void txtchinh_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{Tab}");
		}

		private void txtphu1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{Tab}");
		}

		private void txtphu2_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{Tab}");
		}
		
		private void cboloai_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
				
		}

		private void txtthuong_KeyDown_1(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{Tab}");
		}

		private bool kiemtra_textbox(TextBox t)
		{
            if (t.Text.Trim() != "")
            {
                decimal a = decimal.Parse(t.Text.Trim());
                if (a > 26 || a < 0)
                {
                    MessageBox.Show(lan.Change_language_MessageText("Không hợp lệ !"),lan.Change_language_MessageText( "Thông báo"));
                    t.Focus();
                    return false;
                }
            }
            return true;
		}

		private void txtphep_Validated(object sender, System.EventArgs e)
		{
			if (!kiemtra_textbox(txtphep)) return ;
            DataRow[] dr = ds.Tables[0].Select("manv='" + txtManv.Text + "'");
            if (dr.Length > 0)
            {
                if (txtphep.Text != "")
                {
                    luutam.Tables[0].Rows[0]["nghi_pn"] = dr[0]["nghi_pn"] = txtphep.Text;
                    luutam.Tables[0].Rows[0]["ngay_lv"] = dr[0]["ngay_lv"] = tinh_ngay(dr).ToString();
                }
            }
		}

		private void txtom_Validated(object sender, System.EventArgs e)
		{
			if (!kiemtra_textbox(txtom)) return;
            DataRow[] dr = ds.Tables[0].Select("manv='" + txtManv.Text + "'");
            if (dr.Length > 0)
            {
                if (txtom.Text != "")
                {
                    luutam.Tables[0].Rows[0]["nghi_om"] = dr[0]["nghi_om"] = txtom.Text;
                    luutam.Tables[0].Rows[0]["ngay_lv"] = dr[0]["ngay_lv"] = tinh_ngay(dr).ToString();
                }
            }
		}

		private void txtthaisan_Validated(object sender, System.EventArgs e)
		{
			if (!kiemtra_textbox(txtthaisan)) return;
            DataRow[] dr = ds.Tables[0].Select("manv='" + txtManv.Text + "'");
            if (dr.Length > 0)
            {
                if (txtthaisan.Text != "")
                {
                    luutam.Tables[0].Rows[0]["nghi_ts"] = dr[0]["nghi_ts"] = txtthaisan.Text;
                    luutam.Tables[0].Rows[0]["ngay_lv"] = dr[0]["ngay_lv"] = tinh_ngay(dr).ToString();
                }
            }

		}

		private void txtkoluong_Validated(object sender, System.EventArgs e)
		{
			if (!kiemtra_textbox(txtkoluong)) return;
            DataRow[] dr = ds.Tables[0].Select("manv='" + txtManv.Text + "'");
            if (dr.Length > 0)
            {
                if (txtkoluong.Text != "")
                {
                    luutam.Tables[0].Rows[0]["nghi_kl"] = dr[0]["nghi_kl"] = txtkoluong.Text;
                    luutam.Tables[0].Rows[0]["ngay_lv"] = dr[0]["ngay_lv"] = tinh_ngay(dr).ToString();
                }
            }
		}
        private decimal tinh_ngay(DataRow[] dr1 )
        {
            string pn = "", om = "", tsan = "", kl = "", bu = "", kt = "", com = "", tn = "", khac = "", sc = "";
            decimal nlv = 0;
            pn = (dr1[0]["nghi_pn"].ToString() != "" ? dr1[0]["nghi_pn"].ToString() : "0");
            om = (dr1[0]["nghi_om"].ToString() != "" ? dr1[0]["nghi_om"].ToString() : "0");
            tsan = (dr1[0]["nghi_ts"].ToString() != "" ? dr1[0]["nghi_ts"].ToString() : "0");
            kl = (dr1[0]["nghi_kl"].ToString() != "" ? dr1[0]["nghi_kl"].ToString() : "0");
            bu = (dr1[0]["nghi_bu"].ToString() != "" ? dr1[0]["nghi_bu"].ToString() : "0");
            kt = (dr1[0]["nghi_kt"].ToString() != "" ? dr1[0]["nghi_kt"].ToString() : "0");
            com = (dr1[0]["nghi_co"].ToString() != "" ? dr1[0]["nghi_co"].ToString() : "0");
            tn = (dr1[0]["nghi_tn"].ToString() != "" ? dr1[0]["nghi_tn"].ToString() : "0");
            sc = (dr1[0]["nghi_sc"].ToString() != "" ? dr1[0]["nghi_sc"].ToString() : "0");
            khac = (dr1[0]["nghi_khac"].ToString() != "" ? dr1[0]["nghi_khac"].ToString() : "0");

            nlv = nc - (decimal.Parse(pn) + decimal.Parse(om) + decimal.Parse(tsan) + decimal.Parse(kl)
                + decimal.Parse(bu) + decimal.Parse(kt) + decimal.Parse(com) + decimal.Parse(tn)
                + decimal.Parse(sc) + decimal.Parse(khac));
            return nlv;
        }

		private void txthoisuc_thuong_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{Tab}");
		}

		private void txthoisuc_cn_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{Tab}");
		}

		private void txthoisuc_le_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{Tab}");
		}

		private void combobphan_SelectedIndexChanged(object sender, System.EventArgs e)
		{
            
            if (this.ActiveControl == combobphan)
			{
					if(combobphan.SelectedIndex!=-1)
					{
                        s_bophan = combobphan.SelectedValue.ToString();
                        load_datagrid();
					}	
			}	
						
		}
        private void load_datagrid()
        {
            int i = 0, sngay = 0;
          
            lamsach();
            try
            {
                sngay = cuoituan(Convert.ToInt32(thang1),Convert.ToInt32(nam1));
                //ds = mDB.load_ds_chamcong(thang1, nam1, s_bophan);
                foreach (DataRow r in ds.Tables[0].Rows)
                {
                    i++;
                    r["stt"] = i.ToString();
                    r["t7cn"] = sngay;
                    r["ntthang"] = songay;
                    udate_nghi_sc(r["manv"].ToString());
                }
                try
                {
                    ngay_lv = Convert.ToInt32(ds.Tables[0].Rows[0]["ngay_tt"].ToString());
                }
                catch
                {
                    ngay_lv = 26;
                }
                
                dataGridchamcong.DataSource = ds.Tables[0];
                cbohoten.DisplayMember = "hoten";
                cbohoten.ValueMember = "manv";
                cbohoten.DataSource = ds.Tables[0];
            }
            catch (Exception ex) {string s= ex.Message; }
        }

        public int cuoituan(int month,int year)
        {
            try
            {
                int ngay = 0;
                DateTime d1;
                songay = DateTime.DaysInMonth(year, month);
                for (int i = 1; i <= songay; i++)
                {
                    d1 = new DateTime(year, month, i);
                    if (d1.DayOfWeek == DayOfWeek.Sunday || d1.DayOfWeek == DayOfWeek.Saturday)
                        ngay++;
                }
                return ngay;
            }
            catch
            {
                return 0;
            }
        }

		private void cbo_Loaitatca_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter)
				SendKeys.Send("{Tab}{F4}");
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void combobphan_Validating(object sender, System.ComponentModel.CancelEventArgs e)
		{
            if (combobphan.SelectedIndex != -1)
            {
                combobphan.Enabled = false;
            }
		}

        //private void frm2_0chamcongPhucap_FormClosing(object sender, FormClosingEventArgs e)
        //{
        //    if (ds.HasChanges())
        //    {
        //        DialogResult = MessageBox.Show("Dữ liệu đã bị thay đổi. Bạn có muốn lưu lại không?", AccessPayroll.Msg, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
        //        switch (DialogResult)
        //        {
        //            case DialogResult.Cancel:
        //                e.Cancel = true;
        //                break;
        //            case DialogResult.No:
        //                break;
        //            case DialogResult.Yes:
        //                buttonsave.PerformClick();
        //                break;
        //        }
        //    }
        //}

        public void cmdChonkp_Click(object sender, EventArgs e)
        {
            combobphan.Enabled = true;
            SendKeys.Send("{F4}");
            combobphan.Focus();
        }

        private void txtManv_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode==Keys.Enter)
                SendKeys.Send("{Tab}{F4}");
        }

        private void txtPhai_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }
        private void f_tinh_ngay_lv_tt()
        {
            decimal pn = 0,om=0,tsan=0,kl=0,nc=0,ngaylv=0, bu= 0, co =0,kt=0,sc= 0, tn =0, khac = 0;
            string sql = "";
            sql = "select * from " + mDB.user_payroll + ".heso where mm='" + thang1 + "' and yyyy='" + nam1 + "'";
            try
            {
                foreach (DataRow r1 in mDB.get_data(sql).Tables[0].Rows)
                    nc = decimal.Parse(r1["lamviec"].ToString());
            }
            catch (Exception ex)
            {
                nc = 0;
                MessageBox.Show(ex.ToString());
            }
            foreach (DataRow r in ds.Tables[0].Rows)
            {
                pn = 0; om = 0; tsan = 0; kl = 0; 
                //nc=decimal.Parse(r["ngay_tt"].ToString());
                if (r["nghi_pn"].ToString() != "")
                    pn = decimal.Parse(r["nghi_pn"].ToString());
                if (r["nghi_om"].ToString() != "")
                    om = decimal.Parse(r["nghi_om"].ToString());
                if (r["nghi_ts"].ToString() != "")
                    tsan = decimal.Parse(r["nghi_ts"].ToString());
                if (r["nghi_kl"].ToString() != "")
                    kl = decimal.Parse(r["nghi_kl"].ToString());
                if (r["nghi_bu"].ToString() != "")
                    bu = decimal.Parse(r["nghi_bu"].ToString());
                if (r["nghi_co"].ToString() != "")
                    co = decimal.Parse(r["nghi_co"].ToString());
                if (r["nghi_kt"].ToString() != "")
                    kt = decimal.Parse(r["nghi_kt"].ToString());
                if (r["nghi_sc"].ToString() != "")
                    sc = decimal.Parse(r["nghi_sc"].ToString());
                if (r["nghi_tn"].ToString() != "")
                    tn = decimal.Parse(r["nghi_khac"].ToString());
                if (r["nghi_kl"].ToString() != "")
                    khac = decimal.Parse(r["nghi_khac"].ToString());
                ngaylv = (nc - (pn + om + tsan + kl + bu + co +kt +sc + tn + khac));

                r["ngay_lv"] = ngaylv;;
            }
            ds.AcceptChanges();

        }
        private void butAdd_Click(object sender, EventArgs e)
        {
            luutam.AcceptChanges();
            save(luutam);
            SendKeys.Send("{F4}");
            cbohoten.Focus();
        }

        public void buttonundo_Click(object sender, EventArgs e)
        {
            load_datagrid();
            dataGridchamcong.Focus();
        }

        private void cmdChon_Click(object sender, EventArgs e)
        {
            string m_loai = "";
            decimal _ma = 0, _mb = 0, _mc = 0, _md = 0, _me = 0;
            if (cboAbc.SelectedIndex != -1)
                m_loai = cboAbc.SelectedValue.ToString();
            else
                return;
            //
            sql = "select * from " + mDB.user_payroll + ".heso where mm='" + thang1 + "' and yyyy='" + nam1 + "'";
            foreach (DataRow r1 in mDB.get_data(sql).Tables[0].Rows)
            {
                _ma = (r1["ma"].ToString() != "") ? decimal.Parse(r1["ma"].ToString()) : 0;
                _mb = (r1["mb"].ToString() != "") ? decimal.Parse(r1["mb"].ToString()) : 0;
                _mc = (r1["mc"].ToString() != "") ? decimal.Parse(r1["mc"].ToString()) : 0;
                _md = (r1["md"].ToString() != "") ? decimal.Parse(r1["md"].ToString()) : 0;
                _me = (r1["me"].ToString() != "") ? decimal.Parse(r1["me"].ToString()) : 0;
            }
            //
            if (m_loai != "")
            {
                //sql = "update " + mDB.user_payroll + ".bcc set loai='" + m_loai + "' where mmyy='" + s_mmyy + "' and madv='" + s_bophan + "'";
                sql = " update " + mDB.user_payroll + ".bcc set ";
                sql += " loai='" + m_loai + "',";
                switch (m_loai.ToString())
                {
                    case "A":
                        sql += " thuongabc=" + _ma ;
                        break;
                    case "B":
                        sql += " thuongabc=" + _mb ;
                        break;
                    case "C":
                        sql += " thuongabc=" + _mc ;
                        break;
                }
                sql+=" where mmyy='" + s_mmyy + "' and madv='" + s_bophan + "'";
                if (MessageBox.Show(lan.Change_language_MessageText("Bạn có đồng ý cập nhật loại ") + m_loai +lan.Change_language_MessageText( " cho tất cả nhân viên trong bộ phận ") + combobphan.Text + " không ?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    mDB.Execute_data(sql);
                    load_datagrid();
                }
                

            }
        }

        private void txtphep_KeyPress(object sender, KeyPressEventArgs e)
        {
            if ((e.KeyChar < '0' || e.KeyChar > '9') && e.KeyChar != '\b')
                e.KeyChar = '\0';
        }

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        //public DataSet getdulieu()
        //{
        //    string sql = "select (b.ho || ' '::text) || b.ten AS hoten,";
        //    sql+="c.ten AS chucdanh, a.*";
        //    sql+=" from "+mDB.user_human+".chamcong_"+s_mmyy+" a ";
        //    sql+=" join "+mDB.user_human+".llnv b on a.manv=b.manv ";
        //    sql+=" join "+mDB.user_human+".dmcd c on c.ma=b.macd ";
        //    sql += " join "+mDB.user_human+".bophan d on d.madv=b.madv ";
        //    sql += " where d.madv='"+s_bophan+"'";
        //    return mDB.get_data(sql);
        //}

        //string lydo = "";
        //int n_phep, n_om, n_ts, n_kl, n_nlv, n_k,vtri=0;
        ////private void btntonghop_Click(object sender, EventArgs e)
        //{
        //    save(tonghopdulieu());
        //    load_datagrid();
        //}

        //public DataSet tonghopdulieu()
        //{
        //    DataSet dulieu = getdulieu();
        //    newTable();
        //    foreach (DataRow dr in dulieu.Tables[0].Rows)
        //    {
        //        vtri++;
        //        n_phep = 0; n_om = 0; n_ts = 0; n_kl = 0; n_k = 0; n_nlv = 0;
        //        for (int i = 1; i <= 31; i++)
        //        {
        //            lydo = dr["n" + i].ToString();
        //            switch (lydo)
        //            {
        //                case "PN": { n_phep++; break; }
        //                case "BO": { n_om++; break; }
        //                case "CO": { n_om++; break; }
        //                case "DE": { n_ts++; break; }
        //                case "ST": { n_ts++; break; }
        //                case "KD": { n_kl++; break; }
        //                case "KL": { n_kl++; break; }
        //                case "KH": { n_k++; break; }
        //                case "TN": { n_k++; break; }
        //                case "HO": { n_k++; break; }
        //                case "CT": { n_k++; break; }
        //                case "BU": { n_k++; break; }
        //                case "VR": { n_k++; break; }
        //                case "AD": { n_k++; break; }
        //            }
        //        }
        //        n_nlv = ngay_lv - (n_ts + n_om + n_kl + n_k);
        //        dt.Rows.Add(vtri, dr["manv"].ToString(), dr["hoten"].ToString(), dr["chucdanh"].ToString(), ngay_lv, n_phep, n_om, n_ts, n_kl, n_k, n_nlv);
        //    }
        //    dulieu = new DataSet();
        //    dulieu.Tables.Add(dt);
        //    return dulieu;
        //}

        //DataTable dt;
        //public DataTable newTable()
        //{
        //    dt = new DataTable();
        //    dt.Columns.Add("Sott",typeof(int));
        //    dt.Columns.Add("manv", typeof(string));
        //    dt.Columns.Add("hoten", typeof(string));
        //    dt.Columns.Add("chucdanh", typeof(string));
        //    dt.Columns.Add("songay", typeof(int));
        //    dt.Columns.Add("nghi_pn", typeof(int));
        //    dt.Columns.Add("nghi_om", typeof(int));
        //    dt.Columns.Add("nghi_ts", typeof(int));
        //    dt.Columns.Add("nghi_kl", typeof(int));
        //    dt.Columns.Add("nghi_k", typeof(int));
        //    dt.Columns.Add("ngay_lv", typeof(int));
        //    return dt;
        //}

        private void dataGridchamcong_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            try
            {
                dataGridchamcong_CurrentCellChanged(null, null);
            }
            catch
            {
            }

        }
        //CreateData cre;

        private void dataGridchamcong_CurrentCellChanged(object sender, EventArgs e)
        {
            try
            {
                DataRowView arv = (DataRowView)(dataGridchamcong.CurrentRow.DataBoundItem);

                luutam.Tables[0].Rows[0]["manv"] = txtManv.Text = arv["manv"].ToString();
                cbohoten.SelectedValue = arv["manv"].ToString();
                txtphep.Text = arv["nghi_pn"].ToString();
                txtnghibu.Text = arv["nghi_bu"].ToString();
                txtconom.Text = arv["nghi_co"].ToString();
                txtom.Text = arv["nghi_om"].ToString();
                txtkhamthai.Text = arv["nghi_kt"].ToString();
                txttainan.Text = arv["nghi_tn"].ToString();
                txtkoluong.Text = arv["nghi_kl"].ToString();
                txtsinhcon.Text = arv["nghi_sc"].ToString();
                txtthaisan.Text = arv["nghi_ts"].ToString();
                txtnghikhac.Text = arv["nghi_khac"].ToString();

                if (arv["phai"].ToString().Trim().Equals("Nam"))
                {
                    txtthaisan.Text = "";
                    txtsinhcon.Text = "";
                    txtkhamthai.Text = "";
                    checknghilau.Enabled = false;
                    txtthaisan.Enabled = false;
                    txtsinhcon.Enabled = false;
                    txtkhamthai.Enabled = false;
                }
                else
                {
                    txtthaisan.Text = arv["nghi_ts"].ToString();
                    txtsinhcon.Text = arv["nghi_sc"].ToString();
                    txtkhamthai.Text = arv["nghi_kt"].ToString();
                    txtom.Text = arv["nghi_om"].ToString();
                    txtconom.Text = arv["nghi_co"].ToString();
                    txttainan.Text = arv["nghi_tn"].ToString();
                    txtkoluong.Text = arv["nghi_kl"].ToString();
                    txtphep.Text =  arv["nghi_pn"].ToString();
                    txtnghikhac.Text = arv["nghi_khac"].ToString();
                    txtnghibu.Text =  arv["nghi_bu"].ToString();

                    txtthaisan.Enabled = true;
                    txtsinhcon.Enabled = true;
                    txtkhamthai.Enabled = true;
                    checknghilau.Enabled = true;
                }
                txttainan.Text = arv["nghi_tn"].ToString();
                txtkoluong.Text = arv["nghi_kl"].ToString();
                txtnghikhac.Text = arv["nghi_khac"].ToString();
                txtnghibu.Text = arv["nghi_bu"].ToString();
                txtom.Text = arv["nghi_bo"].ToString();
                checknghilau.Checked = Convert.ToBoolean((arv["dilamlai"].ToString() == "" ? "false" : arv["dilamlai"].ToString()));
                txtthoigiannghi.Text = arv["thoigian"].ToString();
            }
            catch { }
        }

        private void checknghilau_CheckedChanged(object sender, EventArgs e)
        {
            if (checknghilau.Checked)
                txtthoigiannghi.Enabled = true;
            else
            {
                txtthoigiannghi.Enabled = false;
                txtthoigiannghi.Text = "";
            }
        }

        private void checknghilau_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }

        //private void txtthoigiannghi_Validated(object sender, EventArgs e)
        //{
        //    try
        //    {
        //        if (txtthoigiannghi.Text != "" && Convert.ToInt32(txtthoigiannghi.Text) > 0)
        //        {
        //            DataRow[] dr = ds.Tables[0].Select("manv='" + txtManv.Text + "'");
        //            if (dr.Length > 0)
        //                dr[0]["thoigian"] = txtthoigiannghi.Text.Trim();
        //        }
        //        else
        //        {
        //            MessageBox.Show("Nhập số tháng phải > 0");
        //            txtthoigiannghi.Text = "";
        //            txtthoigiannghi.Focus();
        //        }
        //    }
        //    catch { }
        //}

        private void checknghilau_Validated(object sender, EventArgs e)
        {
             DataRow[] dr = ds.Tables[0].Select("manv='" + txtManv.Text + "'");
            if (dr.Length > 0)
                dr[0]["dilamlai"] = checknghilau.Checked;
            if (!checknghilau.Checked)
                dr[0]["thoigian"] = 0;
        }

        DataSet luutam = new DataSet();
        public DataSet newDataset()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("manv",typeof(string));
            dt.Columns.Add("nghi_pn", typeof(int));
            dt.Columns.Add("nghi_bu", typeof(int));
            dt.Columns.Add("nghi_co", typeof(int));
            dt.Columns.Add("nghi_om", typeof(int));
            dt.Columns.Add("nghi_kt", typeof(int));
            dt.Columns.Add("nghi_ts", typeof(int));
            dt.Columns.Add("nghi_sc", typeof(int));
            dt.Columns.Add("nghi_tn", typeof(int));
            dt.Columns.Add("nghi_kl", typeof(int));
            dt.Columns.Add("nghi_khac", typeof(int));
            dt.Columns.Add("thuongabc", typeof(int));
            dt.Columns.Add("ngay_lv", typeof(int));
            dt.Rows.Add("00000",0,0,0,0,0,0,0,0,0,0,0,26);
            luutam.Tables.Add(dt);
            return luutam;
        }

        private void txtnghibu_Validated(object sender, EventArgs e)
        {
            if (!kiemtra_textbox(txtnghibu)) return;
            DataRow[] dr = ds.Tables[0].Select("manv='" + txtManv.Text + "'");
            if (dr.Length > 0)
            {
                if (txtnghibu.Text != "")
                {
                    luutam.Tables[0].Rows[0]["nghi_bu"] = dr[0]["nghi_bu"] = txtnghibu.Text;
                    luutam.Tables[0].Rows[0]["ngay_lv"] = dr[0]["ngay_lv"] = tinh_ngay(dr).ToString();
                }
            }
        }

        private void txtconom_Validated(object sender, EventArgs e)
        {
            if (!kiemtra_textbox(txtconom)) return;
            DataRow[] dr = ds.Tables[0].Select("manv='" + txtManv.Text + "'");
            if (dr.Length > 0)
            {
                if (txtconom.Text != "")
                {
                    luutam.Tables[0].Rows[0]["nghi_co"] = dr[0]["nghi_co"] = txtconom.Text;
                    luutam.Tables[0].Rows[0]["ngay_lv"] = dr[0]["ngay_lv"] = tinh_ngay(dr).ToString();
                }
            }
        }

        private void txtkhamthai_Validated(object sender, EventArgs e)
        {
            if (!kiemtra_textbox(txtkhamthai)) return;
            DataRow[] dr = ds.Tables[0].Select("manv='" + txtManv.Text + "'");
            if (dr.Length > 0)
            {
                if (txtkhamthai.Text != "")
                {
                    luutam.Tables[0].Rows[0]["nghi_kt"] = dr[0]["nghi_kt"] = txtkhamthai.Text;
                    luutam.Tables[0].Rows[0]["ngay_lv"] = dr[0]["ngay_lv"] = tinh_ngay(dr).ToString();
                }
            }
        }

        private void txtsinhcon_Validated(object sender, EventArgs e)
        {
            if (!kiemtra_textbox(txtsinhcon)) return;
            DataRow[] dr = ds.Tables[0].Select("manv='" + txtManv.Text + "'");
            if (dr.Length > 0)
            {
                if (txtsinhcon.Text != "")
                {
                    luutam.Tables[0].Rows[0]["nghi_sc"] = dr[0]["nghi_sc"] = txtsinhcon.Text;
                    luutam.Tables[0].Rows[0]["ngay_lv"] = dr[0]["ngay_lv"] = tinh_ngay(dr).ToString();
                }
            }
        }

        private void udate_nghi_sc(string manv)
        {
            decimal nghi_sc = 0, nghi_om = 0;
            int  thang = 0, nam = 0;
            bool flag = false;
            if (ds_nghi != null && ds_nghi.Tables[0].Rows.Count > 0)
            {
                DataRow[] r = ds_nghi.Tables[0].Select("manv='" + manv + "'");
                if (r.Length > 0)
                {
                    try
                    {
                        nghi_om = Convert.ToDecimal(r[0]["nghi_om"].ToString());
                        nghi_sc = Convert.ToDecimal(r[0]["nghi_sc"].ToString());
                        flag = Convert.ToBoolean(r[0]["dilamlai"].ToString());
                    }
                    catch 
                    {
                        nghi_om = 0;
                        nghi_sc = 0;
                        flag = false;
                    }
                    //if (nghi_sc > 14)
                    //{
                    //    if (flag || r[0]["hs_ud"].ToString().Equals("0"))
                    //        //mDB.update_bhyt_nghiom(manv, thang1, nam1);
                    //    //mDB.update_bhxh_nghi_sc(manv, thang1, nam1);
                    //}
                    //if (nghi_om > 0)
                        //mDB.update_bhyt_nghiom(manv, thang1, nam1);
                }
            }
        }
        
        public void load_dsnghi()
        {
            string sql = "", mmyy = "";
            //int thang, nam;
            //try
            //{
            //    thang = Convert.ToInt32(thang1);
            //    nam = Convert.ToInt32(nam1);
            //}
            //catch
            //{
            //    thang = DateTime.Now.Month;
            //    nam = DateTime.Now.Year;
            //}
            //if (thang == 1)
            //{
            //    nam--;
            //    mmyy = "12" + nam.ToString().Substring(2, 2);
            //}
            //else
            //{
            //    thang--;
            //    mmyy = thang.ToString().PadLeft(2, '0') + nam.ToString().Substring(2, 2);
            //}
            mmyy = thang1.Trim().PadLeft(2, '0') + nam1.Substring(2, 2);
            sql="select a.manv, nghi_sc,nghi_om,dilamlai,case when c.hs_th>0 then 1 else 0 end as hs_ud from luong.nn_" + mmyy + " a ";
            sql+="join luong.dll b on b.manv=a.manv and b.mmyy=a.mmyy ";
            sql += "join luong.bcc_" + mmyy + " c on a.manv=c.manv  where nghi_sc>0";
            ds_nghi = mDB.get_data(sql);
        }


        private void txttainan_Validated(object sender, EventArgs e)
        {
            if (!kiemtra_textbox(txttainan)) return;
            DataRow[] dr = ds.Tables[0].Select("manv='" + txtManv.Text + "'");
            if (dr.Length > 0)
            {
                if (txttainan.Text != "")
                {
                    luutam.Tables[0].Rows[0]["nghi_tn"] = dr[0]["nghi_tn"] = txttainan.Text;
                    luutam.Tables[0].Rows[0]["ngay_lv"] = dr[0]["ngay_lv"] = tinh_ngay(dr).ToString();
                }
            }
        }

        private void txtnghikhac_Validated(object sender, EventArgs e)
        {
            if (!kiemtra_textbox(txtnghikhac)) return;
            DataRow[] dr = ds.Tables[0].Select("manv='" + txtManv.Text + "'");
            if (dr.Length > 0)
            {
                if (txttainan.Text != "")
                {
                    luutam.Tables[0].Rows[0]["nghi_khac"] = dr[0]["nghi_khac"] = txtnghikhac.Text.Trim().Equals("") ? "0" : txtnghikhac.Text.Trim();
                    luutam.Tables[0].Rows[0]["ngay_lv"] = dr[0]["ngay_lv"] = tinh_ngay(dr).ToString();
                }
            }
        }

        private void btntonghop_Click(object sender, EventArgs e)
        {
            if (tonghop())
            {
                load_datagrid();
            }
        }

        private bool tonghop()
        {
            int thang_ = 0, nam_ = 0, day_ = 0;
            string sql = "", tam = "", tam_ = "", madv = "";
            try
            {
                thang_ = Convert.ToInt32(thang1);
                nam_ = Convert.ToInt32(nam1);
                day_ = DateTime.DaysInMonth(nam_, thang_);
                sql = "update luong.nn_" + s_mmyy + " set nghi_pn=c.pn,nghi_bu=c.bu,nghi_om=c.om,nghi_co=c.co,";
                sql += "nghi_kt=c.kt,nghi_ts=c.ts,nghi_sc=c.sc,nghi_tn=c.tn,nghi_kl=c.kl,nghi_khac=c.khac from (select manv,";
                tam = "(";
                tam_ = "(";
                for (int i = 1; i < day_; i++)
                {
                    tam += "case when n" + i.ToString() + "='PN' then 1 else 0 end + ";
                    tam_ += "case when n" + i.ToString() + " not in ('PN','BU','OM','CO','KT','TS','SC','TN','KL','X') then 1 else 0 end + ";
                }
                tam += "case when n" + day_.ToString() + "='PN' then 1 else 0 end ) as PN ";
                tam_ += "case when n" + day_.ToString() + "  not in ('PN','BU','OM','CO','KT','TS','SC','TN','KL','X') then 1 else 0 end) as khac ";
                sql += tam + ",";
                sql += tam.Replace("PN", "BU") + ",";
                sql += tam.Replace("PN", "OM") + ",";
                sql += tam.Replace("PN", "CO") + ",";
                sql += tam.Replace("PN", "KT") + ",";
                sql += tam.Replace("PN", "TS") + ",";
                sql += tam.Replace("PN", "SC") + ",";
                sql += tam.Replace("PN", "TN") + ",";
                sql += tam.Replace("PN", "KL") + ",";
                sql += tam_;
                sql += " from nhansu.chamcong_" + s_mmyy + ") as c where nn_" + s_mmyy + ".manv=c.manv ";
                if (!ck_all.Checked && combobphan.SelectedIndex != -1)
                {
                    madv = combobphan.SelectedValue.ToString();
                    sql += "and nn_" + s_mmyy + ".madv='" + madv + "'";
                }
                //if (mDB.Execute_data(sql) > 0)
                //{
                //    sql = "update luong.bcc_" + s_mmyy + "  set ngay_tt=(ngay_lv-c.nghi_om-c.nghi_co-c.nghi_kt-c.nghi_ts-c.nghi_sc-c.nghi_tn-c.nghi_kl-c.nghi_khac) ";
                //    sql += " from (select manv,nghi_om,nghi_co,nghi_kt,nghi_ts,nghi_sc,nghi_tn,nghi_kl,nghi_khac from luong.nn_" + s_mmyy + ") as c where c.manv=bcc_" + s_mmyy + ".manv ";
                //    if (!madv.Trim().Equals(""))
                //        sql += " and bcc_" + s_mmyy + ".madv='" + madv + "'";
                //    return mDB.Execute_data(sql);
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return false;
            }
            return false;
        }

        private void label_Click(object sender, EventArgs e)
        {

        }

        
	}
}